﻿using MediatR;
using Traceability.Commont.Domains.BatchManagementFiles;
using Traceability.Commont.DTOs.CommontFiles;
using Traceability.Commont.Infrastructures.Interfaces;

namespace U.Enterprise.Api.Applications.WhitestripWeighing
{
    public class WhiteStripWeighingBackViewHandler : IRequestHandler<WhiteStripWeighingBackViewCommond, Resqults>
    {


        private readonly IBateRepository<WhiteNotes> _WhiteNotes;

        public WhiteStripWeighingBackViewHandler(IBateRepository<WhiteNotes> whiteNotes)
        {
            _WhiteNotes = whiteNotes;
        }

        public async Task<Resqults> Handle(WhiteStripWeighingBackViewCommond request, CancellationToken cancellationToken)
        {
           var list=new Resqults() { Code=0};


            var query = _WhiteNotes.GetAll().FirstOrDefault(x => x.WhiteNoteid == request.Sideproductid);


            list.Date = query;


            return list;

        }
    }
}
